<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
	<title>编辑内容</title>
	<script type='text/javascript' src='__ROOT__/Data/Org/Jquery/jquery-1.8.2.min.js'></script>
	<link href='__ROOT__/Data/Org/hdjs/css/hdjs.css' rel='stylesheet' media='screen'>
	<script type='text/javascript' src='__ROOT__/Data/Org/hdjs/js/hdjs.js'></script>
	<script type='text/javascript' src='__ROOT__/Data/Org/hdjs/js/slide.js'></script>
	<script type='text/javascript' src='__ROOT__/Data/Org/hdjs/org/cal/lhgcalendar.min.js'></script>
	<script type='text/javascript'>
		ACTION='__URL__'; //当前模块(控制器)
		ROOT='__ROOT__'; //当前项目根路径
		PUBLIC= '__PUBLIC__';//当前定义的Public目录
	</script>
	<script type="text/javascript">
		$(function(){
			$('form').validate({
				<?php echo ($validate); ?>	
			})
		})
	</script>
	<script type="text/javascript" src="__PUBLIC__/Js/mod.article.js"></script>
	<link rel="stylesheet" type="text/css" href="__PUBLIC__/Css/mod.welcome.css" />
	<link rel="stylesheet" type="text/css" href="__PUBLIC__/Css/mod.base.css" />
</head>
<body>
	<form action="" method="post" enctype='multipart/form-data'>
		<div class="wrap">
			<div class="title-header"><span><?php echo ($cname); ?></span> 编辑内容</div>
			<div class="menu_list">
				<ul>
					<?php if($catType != 4): ?><li>
						<a href="<?php echo U('Article/index',array('cid'=>$field['category_cid']));?>" >
							内容列表
						</a>
					</li><?php endif; ?>
					<li>
						<a href="javascript:;" class="action">
						编辑内容
						</a>
					</li>
				</ul>
			</div>

			<div class="tab">
				<ul class="tab_menu">
					<li lab='base'><a href="#">基本配置</a></li>
					<li lab='pic'><a href="#">图集上传</a></li>
				</ul>
				<div class="tab_content">
					<div id='base'>

			<table class=' hd-form table2'>
				<tbody>
					
					<tr>
						<td class="w100">栏目分类</td>
						<td>
							<?php if($catType != 4): ?><select name="category_cid" >
								<option value="0">请选择分类</option>
								<option <?php if($topid == $field['category_cid']): ?>selected='selected'<?php endif; ?> value="<?php echo ($topid); ?>"><?php echo ($topname); ?></option>
								<?php if(is_array($category)): foreach($category as $key=>$v): ?><option <?php if($v['cid'] == $field['category_cid']): ?>selected='selected'<?php endif; ?> <?php echo ($v["disabled"]); ?> value="<?php echo ($v["cid"]); ?>">---<?php echo ($v["_html"]); echo ($v["cname"]); ?></option><?php endforeach; endif; ?>
							</select>
							<?php else: ?>
							<?php echo ($cname); ?>
							<input type="hidden" name="category_cid" value="<?php echo ($cid); ?>" /><?php endif; ?>
						</td>
					</tr>
					<tr>
						<td class="w100">标题</td>
						<td>
							<input type="text" name="article_title"  class='w350 title' value="<?php echo ($field["article_title"]); ?>"  />
						</td>
					</tr>
					
				
					<tr>
						<td>关键字</td>
						<td>
							<textarea name="keywords" class='w500 h100'><?php echo ($field["keywords"]); ?></textarea>
						</td>
					</tr>
					
					<tr>
						<td>描述</td>
						<td>
							<textarea name="description" class='w500 h100'><?php echo ($field["description"]); ?></textarea>
						</td>
					</tr>
					
					<tr>
						<td>排序</td>
						<td>
							<input name="sort" type="text" class='w200'  value="<?php echo ($field["sort"]); ?>" />
						</td>
					</tr>
					<tr>
						<td>次数</td>
						<td>
							<input name="click" type="text" class='w200'  value="<?php echo ($field["click"]); ?>" />
						</td>
					</tr>
					<tr>
						<td>发布时间</td>
						<td>
							<input name="addtime" id='addtime' type="text" class='w200' value="<?php echo (date('Y-m-d',$field["addtime"])); ?>"/>
							<script>
								$('#addtime').calendar({
									format : 'yyyy-MM-dd'
								});
							</script>
						</td>
					</tr>
					<tr>
						<td>审核</td>
						<td>
							<label >
								<input <?php if($field['verifystate'] == 1): ?>checked="checked"<?php endif; ?> name="verifystate" type="radio"  value="1" /> 审核中
							</label>
							<label >
								<input <?php if($field['verifystate'] == 2): ?>checked="checked"<?php endif; ?>  name="verifystate" type="radio" value="2" /> 通过
							</label>
						</td>
					</tr>
					<tr>
						<td>属性</td>
						<td>

							<?php if(is_array($flag)): foreach($flag as $key=>$v): ?><label >
								<input <?php if(strchr($field['flag'],$v)): ?>checked='checked'<?php endif; ?> name="flag[]" type="checkbox"  value="<?php echo ($v); ?>" /> <?php echo ($v); ?>(<?php echo ($key); ?>)
							</label><?php endforeach; endif; ?>
							
						</td>
					</tr>
					<tr>
						<td>图片</td>
						<td>
							<input type="file" name='pic'/>
							<br/>
							<img src="<?php echo ($field["pic"]); ?>" alt=""  width="100" />
							<?php if($field["has_pic"]): ?><a href="javascript:;" onclick="del_attachment(this,'<?php echo ($field["aid"]); ?>','pic')">删除</a><?php endif; ?>
						</td>
					</tr>
					<tr >
						<td>文件</td>
						<td>
							<input type="file" name='file'/>
							<br/>
							<?php if($field['file']): ?><a href="<?php echo ($field["downurl"]); ?>">下载</a><?php endif; ?>
							<?php if($field["has_file"]): ?><a href="javascript:;" onclick="del_attachment(this,'<?php echo ($field["aid"]); ?>','file')">删除</a><?php endif; ?>
						</td>
					</tr>
				
					<?php if(is_array($extForm)): foreach($extForm as $key=>$v): ?><tr>
						<td><?php echo ($v["title"]); ?></td>
						<td><?php echo ($v["html"]); ?></td>
					</tr><?php endforeach; endif; ?>
					<?php if($attrForm): ?><tr>
						<th align='left' colspan='2'>筛选</th>
					</tr>
					<?php if(is_array($attrForm)): foreach($attrForm as $key=>$v): ?><tr>
						<td><?php echo ($v["title"]); ?></td>
						<td><?php echo ($v["html"]); ?></td>
					</tr><?php endforeach; endif; endif; ?>
				</tbody>
			</table>
			</div>
					<div id='pic'>
						<?php if(!$attrPicCount): ?><ul class='one_pic'>
							<?php if(is_array($pics)): foreach($pics as $key=>$p): ?><li>
								<img src="<?php echo ($p["big"]); ?>" alt=""  width="100" />
								<p><?php echo ($p["pic_title"]); ?></p>
								<span rel="<?php echo ($p["id"]); ?>" onclick='del_img(this)'>×</span>
							</li><?php endforeach; endif; ?>
						</ul>
				
						<table cellpadding="0" cellspacing="0" class='table2 hd-form'>
							<tr>
								<td width="20"><span class='hand' onclick='add_pic(this)'>[+]</span></td>
								<td width="50"><input type="file" name="img[]" class="input noborder" /></td>
								<td><input type="text" name="pic_title[]" class="input" /></td>
							</tr>

						</table>
						<?php else: ?>


								<div class="color">
								
							
									<ul class="color_menu">
										<?php if(is_array($pics)): foreach($pics as $key=>$attr): ?><li lab='attr<?php echo ($attr["attr_value_id"]); ?>' ><a href="#" ><?php echo ($attr["attr_value"]); ?></a></li><?php endforeach; endif; ?>
									</ul>
									
									<div class="color_content">
										
										<?php if(is_array($pics)): foreach($pics as $key=>$attr): ?><div id='attr<?php echo ($attr["attr_value_id"]); ?>'>

											<ul class='one_pic'>
												<?php if(is_array($attr["pics"])): foreach($attr["pics"] as $key=>$p): ?><li>
													<img src="<?php echo ($p["big"]); ?>" alt=""  width="100" />
													<p><?php echo ($p["pic_title"]); ?></p>
													<span rel="<?php echo ($p["id"]); ?>" onclick='del_img(this)'>×</span>
												</li><?php endforeach; endif; ?>
											</ul>
											<table class='table2 hd-form'>
												<tr>
													<td width="20"><span class='hand' onclick='add_pic(this)'>[+]</span></td>
													<td ><input type="file" name="img<?php echo ($attr["attr_value_id"]); ?>[]" class="input noborder" /></td>
													<td style='display:none'><input type="text" name="pic_title<?php echo ($attr["attr_value_id"]); ?>[]" class="input" /></td>
												</tr>
											</table>
										</div><?php endforeach; endif; ?>
										
									</div>
									<input type='hidden' name='attrPic' value='1' />
							</div><?php endif; ?>
					</div>
				</div>
			</div>
		</div>
	<div class="position-bottom">
		<input type="hidden" name="aid" value="<?php echo ($field["aid"]); ?>" />
		<input type="submit" class='hd-success' value="编辑" />
		<input type="button" class="hd-cancel" onclick="location.href='<?php echo U('Article/index',array('cid'=>$field['category_cid']));?>'" value="返回"/>	
	</div>
	</form>

</body>
</html>